package com.etc.dao;

import com.etc.entity.OrderOperation;
import com.etc.entity.OrderOperationExample;
import com.etc.entity.OrderOperationKey;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectKey;
import org.apache.ibatis.annotations.Update;

public interface OrderOperationMapper {
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table order_operation
     *
     * @mbggenerated
     */
    int countByExample(OrderOperationExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table order_operation
     *
     * @mbggenerated
     */
    int deleteByExample(OrderOperationExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table order_operation
     *
     * @mbggenerated
     */
    @Delete({
        "delete from order_operation",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(OrderOperationKey key);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table order_operation
     *
     * @mbggenerated
     */
    @Insert({
        "insert into order_operation (id, order_no, ",
        "is_pickup, pickup_staff_id, ",
        "pickup_date, is_complete, ",
        "complete_data, is_delivery, ",
        "delivery_staff_id, delivery_date)",
        "values (#{id,jdbcType=INTEGER}, #{orderNo,jdbcType=VARCHAR}, ",
        "#{isPickup,jdbcType=VARCHAR}, #{pickupStaffId,jdbcType=INTEGER}, ",
        "#{pickupDate,jdbcType=TIMESTAMP}, #{isComplete,jdbcType=VARCHAR}, ",
        "#{completeData,jdbcType=VARCHAR}, #{isDelivery,jdbcType=VARCHAR}, ",
        "#{deliveryStaffId,jdbcType=INTEGER}, #{deliveryDate,jdbcType=TIMESTAMP})"
    })
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="id", before=true, resultType=Integer.class)
    int insert(OrderOperation record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table order_operation
     *
     * @mbggenerated
     */
    int insertSelective(OrderOperation record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table order_operation
     *
     * @mbggenerated
     */
    List<OrderOperation> selectByExample(OrderOperationExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table order_operation
     *
     * @mbggenerated
     */
    @Select({
        "select",
        "id, order_no, is_pickup, pickup_staff_id, pickup_date, is_complete, complete_data, ",
        "is_delivery, delivery_staff_id, delivery_date",
        "from order_operation",
        "where id = #{id,jdbcType=INTEGER}"
    })
    @ResultMap("BaseResultMap")
    OrderOperation selectByPrimaryKey(OrderOperationKey key);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table order_operation
     *
     * @mbggenerated
     */
    int updateByExampleSelective(@Param("record") OrderOperation record, @Param("example") OrderOperationExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table order_operation
     *
     * @mbggenerated
     */
    int updateByExample(@Param("record") OrderOperation record, @Param("example") OrderOperationExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table order_operation
     *
     * @mbggenerated
     */
    int updateByPrimaryKeySelective(OrderOperation record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table order_operation
     *
     * @mbggenerated
     */
    @Update({
        "update order_operation",
        "set order_no = #{orderNo,jdbcType=VARCHAR},",
          "is_pickup = #{isPickup,jdbcType=VARCHAR},",
          "pickup_staff_id = #{pickupStaffId,jdbcType=INTEGER},",
          "pickup_date = #{pickupDate,jdbcType=TIMESTAMP},",
          "is_complete = #{isComplete,jdbcType=VARCHAR},",
          "complete_data = #{completeData,jdbcType=VARCHAR},",
          "is_delivery = #{isDelivery,jdbcType=VARCHAR},",
          "delivery_staff_id = #{deliveryStaffId,jdbcType=INTEGER},",
          "delivery_date = #{deliveryDate,jdbcType=TIMESTAMP}",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(OrderOperation record);
}